﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using MyFloridaHouse.ServiceConn.DistrBldrSvcRef;

namespace MyFloridaHouse.libSvOpenDistricts.Census
{
    [DataContract(IsReference = true)]
    public class CensusGeometryNode
    {
        const int databaseNull = -1;

        private bool _isLocked = false;
        [DataMember]
        public bool isLocked
        {
            get { return _isLocked; }
            set { _isLocked = value; }
        }

        private int _parentuogID;
        [DataMember]
        public int parentuogID { set { _parentuogID = value; } get { return _parentuogID; } }

        private List<CensusGeometryNode> _childNodeList;
        [DataMember]
        public List<CensusGeometryNode> childNodeList { set { _childNodeList = value; } get { return _childNodeList; } }

        private int _districtID = 0;
        [DataMember]
        public int districtID { set { _districtID = value; } get { return _districtID; } }

        private string _doj00;
        [DataMember]
        public string doj00 { set { _doj00 = value; } get { return _doj00; } }

        private int _uogID;
        [DataMember]
        public int uogID { set { _uogID = value; } get { return _uogID; } }

        private int _uogType;
        [DataMember]
        public int uogType { set { _uogType = value; } get { return _uogType; } } // todo: uogType should be an enumeration

        private int _layerID;
        [DataMember]
        public int layerID { set { _layerID = value; } get { return _layerID; } }

        private int _regionID;
        [DataMember]
        public int regionID { set { _regionID = value; } get { return _regionID; } }

        // Constructor
        public CensusGeometryNode( CensusGeometryDTO dto)
        {
            // set up the node data
            if (dto.parentUogID == databaseNull)
                parentuogID = -1;
            else
                parentuogID = dto.parentUogID;
            childNodeList = new List<CensusGeometryNode>();
            doj00 = dto.doj00;
            uogID = dto.uogID;
            uogType = dto.uogType;
            layerID = dto.layerID;
            regionID = dto.regionID;
            districtID = CensusGeometryConstants.unassignedDistrictID;

        }

    }
}
